This disclosure relates generally to a computer software system and associated method for providing additional functionality for querying and formatting XML, and more particularly to implementation of an API that permits plug-in libraries of functions in other languages within XQuery.
Extensible Markup Language (XML) is a programming language operating as an extension to HTML and providing enhanced control of content. It may be used to define the content of a document (such as a Web page) rather than the presentation of it or to exchange information and documents between diverse systems. XML is text-based and formats data by using document tags to catalog information. Key elements in a document may be categorized according to meaning, enabling a search engine to scan an entire document for the XML tags that identify individual pieces of text and images rather than selecting a document by the metatags listed in its header.
There are various strategies for storing and managing XML documents. In XML repositories based on relational database technology, the XML is stored using a method known as “shredding”. In this approach, the markup is broken up and stored in fields of database tables, and XML queries are translated into a relational query language (e.g. SQL, Structured Query Language) that retrieves the values from the database using relational operations, and generates the markup output. Overhead for storage is high, and performance for regeneration of the XML (or “round-tripping” of entire XML documents) is typically low. Other database managers designed specifically for XML utilize indexing schemes to process the markup representation of XML more efficiently.
Applications for querying XML databases (such as XQuery, a general-purpose XML query language) often require the ability to perform full-text search on the stored data. The search functionality must be integrated within the query language to allow for control over the structures to be searched, and to make search results available to other XQuery constructs. The XQuery specification contains a set of set forth in the XQuery specification functions that can be called from within query expressions, and also allows for user-defined functions that are written in XQuery.
An example of one approach to querying XML documents is presented in U.S. Pat. No. 6,654,734 to Mani et al. (“System and Method for Query Processing and Optimization for XML Repositories”). The query system of Mani et al. views the data in XML documents as a graph that allows queries on content, structure, inter-document links, and intra-document links. The query language is based on tree pattern match semantics using XML semantics, with features that allow the query system to compute a document type definition for the query language and use it to validate the user query formulation. Query optimization is accomplished using schema-based optimization and index-based optimization. The structure pattern is then converted to a string for storage purposes.
Another approach is described in U.S. patent application Publication No. 2002/0169788 to Lee et al. (“System and Method for Automatic Loading of an XML Document Defined by a Document-Type Definition into a Relational Database Including the Generation of a Relational Schema Therefor”). Under the system of Lee et al., a relational schema is created out of a DTD, and XML data is loaded into the generated relational schema that adheres to the DTD. Starting with a DTD for an XML document containing data, all of the information in the DTD is captured into metadata tables, and then the metadata tables are queried to generate the relational schema. The data contained in the XML document can then be loaded into the generated relational schema.
While the XQuery specification provides certain functionality within set forth in the XQuery specification functions, and other functionality can be added via user-defined functions written in XQuery, some functionality required for applications using XQuery can not be efficiently implemented within XQuery, and there is no mechanism for linking to externally implemented functions. It would be desirable to provide a mechanism to dynamically link to externally implemented functions in “plug-in” libraries to enhance functionality.